﻿CREATE TABLE [dbo].[Permission] (
    [Id]                 UNIQUEIDENTIFIER DEFAULT (newid()) NOT NULL,
    [OwnerID]            UNIQUEIDENTIFIER NOT NULL,
    [ModuleID]           UNIQUEIDENTIFIER NOT NULL,
    [Visible]            BIT              NOT NULL,
    [Edit]               BIT              NULL,
    [Remove]             BIT              NULL,
    [PrintTo]            BIT              NULL,
    [Audit]              BIT              NULL,
    [Approve]            BIT              NULL,
    [Invalid]            BIT              NULL,
    [Extensions]         NVARCHAR (MAX)   DEFAULT ('<permission/>') NULL,
    [LastModifiedTime]   DATETIME         NOT NULL,
    [LastModifiedUserID] UNIQUEIDENTIFIER NOT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FKF39AF8AF11E65B0E] FOREIGN KEY ([LastModifiedUserID]) REFERENCES [dbo].[UserProfile] ([ID])
);


GO
CREATE NONCLUSTERED INDEX [IDX_IDX_Permission_ModuleID]
    ON [dbo].[Permission]([ModuleID] ASC);

